package com.star.model;

import java.util.Date;


import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.springframework.stereotype.Service;

import io.ebean.Ebean;
import io.ebean.ExpressionList;
import io.ebean.annotation.DbComment;

@Entity
@Table(name = "tbl_test222")
@DbComment("oss处理日志表222222")
public class OSSLog2 {
	@Id
	@Column(name = "id", nullable = false)
	@GeneratedValue(strategy = GenerationType.SEQUENCE)
	private Long id;

	@Column(name = "file_name")
	@DbComment("文件名称2222222")
	private String fileName;

	@Column(name = "status")
	@DbComment("处理状态 0:未处理 1.oss上传失败 2.oss处理成功 3.回写写成功")
	private Integer status;

	@Column(name = "source_tbl")
	@DbComment("来源表名")
	private String sourceTbl;

	@Column(name = "source_col")
	@DbComment("来源列")
	private String sourceCol;

	@Column(name = "source_project")
	@DbComment("来源项目")
	private String sourceProject;

	@Column(name = "source_id")
	@DbComment("来源id")
	private String sourceId;

	@Column(name = "oss_file_url", length = 1000)
	@DbComment("oss访问url")
	private String ossFileUrl;

	@Column(name = "oss_msg")
	@DbComment("oss信息")
	@Lob
	private String ossMsg;

	@Column(name = "oss_error_code")
	@DbComment("oss状态:0成功  ")
	private String ossErrorCode;

	@Column(name = "oss_process_begin_date")
	@DbComment("oss处理开始日期")
	private Date ossProcessBeginDate;

	@Column(name = "oss_process_end_date")
	@DbComment("oss处理结束日期")
	private Date ossProcessEndDate;

	@Column(name = "inserted_at")
	private Date insertedAt;

	public static enum Status {
		NO_PROCESS(0),OSS_UPLOAD_ERROR(1),OSS_UPLOAD_SUCCESS(2),WRITE_SOURCE_SUCCESS(3);
		public int value;

		Status(int v) {
			this.value = v;
		}
	}

	public static ExpressionList<OSSLog2> where() {
		return Ebean.find(OSSLog2.class).where();
	}

	public void save() {
		this.insertedAt = new Date();
		Ebean.save(this);

	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getFileName() {
		return fileName;
	}

	public void setFileName(String fileName) {
		this.fileName = fileName;
	}

	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}

	public String getSourceTbl() {
		return sourceTbl;
	}

	public void setSourceTbl(String sourceTbl) {
		this.sourceTbl = sourceTbl;
	}

	public String getSourceCol() {
		return sourceCol;
	}

	public void setSourceCol(String sourceCol) {
		this.sourceCol = sourceCol;
	}

	public String getSourceProject() {
		return sourceProject;
	}

	public void setSourceProject(String sourceProject) {
		this.sourceProject = sourceProject;
	}

	public String getOssFileUrl() {
		return ossFileUrl;
	}

	public void setOssFileUrl(String ossFileUrl) {
		this.ossFileUrl = ossFileUrl;
	}

	public String getOssMsg() {
		return ossMsg;
	}

	public void setOssMsg(String ossMsg) {
		this.ossMsg = ossMsg;
	}

	public Date getInsertedAt() {
		return insertedAt;
	}

	public void setInsertedAt(Date insertedAt) {
		this.insertedAt = insertedAt;
	}

	public Date getOssProcessBeginDate() {
		return ossProcessBeginDate;
	}

	public void setOssProcessBeginDate(Date ossProcessBeginDate) {
		this.ossProcessBeginDate = ossProcessBeginDate;
	}

	public Date getOssProcessEndDate() {
		return ossProcessEndDate;
	}

	public void setOssProcessEndDate(Date ossProcessEndDate) {
		this.ossProcessEndDate = ossProcessEndDate;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public String getOssErrorCode() {
		return ossErrorCode;
	}

	public void setOssErrorCode(String ossErrorCode) {
		this.ossErrorCode = ossErrorCode;
	}

	public String getSourceId() {
		return sourceId;
	}

	public void setSourceId(String sourceId) {
		this.sourceId = sourceId;
	}

}
